﻿#pragma once

#include "xplaneConnect.h"
#include <thread>
#include <mutex>
#include <graphics.h>
#include <iostream>

#ifndef MYIP
#define MYIP "10.83.200.185"
#endif

#ifndef M_PI
#define M_PI 3.1415926535
#endif

struct DashboardData {
    std::mutex mtx;          // 互斥锁，用于保护数据访问
    // ND   航向
    float headingAngle = 0, VOR1HL = 0, VOR2HL = 0, VOR1D = 0, VOR2D = 0, GS = 0,TAS=0,WinV=0,WinD=0,height = 0, Rdirection = 0, pitch = 0,choice1=0,VOR1=0,VOR2=0;
	//float pitch = 0;    // 俯仰角（度）
	float roll = 0;     // 横滚角（度）
	//float height = 0;   // 高度（英尺）
	float speed = 0;    // 空速
	float heading = 0;  // 航向
	float Chuispeed = 0;
    int FOB = 0;
    int GW = 0;
    int TAT = 0;
    double GW_CG = 0;
    int SAT = 0;
    double THR = 0;
    int PSI = 0;
    int FT = 0;
    double N1 = 0;
    double N3 = 0;
    double Wheel = 0;
    double Eng = 1;
    double Defrd = 0;
    double SpeedWD = 0;
    double landing = 0;
    float gear1;
    int flag = 0;
    int flag10 = 0, flag20 = 0, flag30 = 0, flag40 = 0, flag50 = 0, flag60 = 0, flag70 = 0, flag80 = 0, flag90 = 0,
        flag100 = 0, flag200 = 0, flag300 = 0, flag400 = 0, flag500 = 0, flag1000 = 0, flag2000 = 0, flag2500 = 0;
};

extern DashboardData sharedData;  // 声明全局共享数据

void xplaneDataThread();
//struct FlightData {
//	float pitch;    // 俯仰角（度）
//	float roll;     // 横滚角（度）
//	float height;   // 高度（英尺）
//	float speed;    // 空速
//	float heading;  // 航向
//};
//extern FlightData data;